// Author	: damphat@gmail.com
// Created	: 01/12/2008

#pragma once
#include "vn/Exception.h"

#define DECLARE_EXCEPTION_CLASS(NEW_CLASS, BASE_CLASS, HRESULT_DEFAULT_VAL)\
	class NEW_CLASS : public BASE_CLASS {\
	public:\
		NEW_CLASS()\
			: BASE_CLASS(HRESULT_DEFAULT_VAL) { }\
		NEW_CLASS(HRESULT hResult)\
			: BASE_CLASS(hResult) { }\
		NEW_CLASS(HRESULT hResult, const String &msg)\
			: BASE_CLASS(hResult, msg) { }\
		NEW_CLASS(const String &msg)\
			: BASE_CLASS(HRESULT_DEFAULT_VAL, msg) { }\
	};

#define HRESULT_ARG					(1 + HRESULT_UNKNOWN)
#define HRESULT_ARG_NULL			(2 + HRESULT_UNKNOWN)
#define HRESULT_ARG_OUTOFRANGE		(3 + HRESULT_UNKNOWN)
#define HRESULT_NOT_SUPPORT			(4 + HRESULT_UNKNOWN)
#define HRESULT_NOT_IMPL			(5 + HRESULT_UNKNOWN)
#define HRESULT_INVALID_OPERATION	(6 + HRESULT_UNKNOWN)

DECLARE_EXCEPTION_CLASS(ArgumentException,				Exception,			HRESULT_ARG)
DECLARE_EXCEPTION_CLASS(ArgumentNullException,			ArgumentException,	HRESULT_ARG_NULL)
DECLARE_EXCEPTION_CLASS(ArgumentOutOfRangeException,	ArgumentException,	HRESULT_ARG_OUTOFRANGE)
DECLARE_EXCEPTION_CLASS(NotSupportedException,			Exception,			HRESULT_NOT_SUPPORT)
DECLARE_EXCEPTION_CLASS(NotImplementedException,		Exception,			HRESULT_NOT_IMPL)
DECLARE_EXCEPTION_CLASS(InvalidOperationException,		Exception,			HRESULT_INVALID_OPERATION)
